<template>
  <div class="container">
    数据接收方---count的值为: {{count}} <br>
  </div>
</template>

<script>
import bus from './EventBus'
export default {
  name: 'MyTest',
  data() {
    return {
      count: 0
    }
  },
  created() {
    // 调用 bus.on 方法注册一个自定义事件，通过事件处理函数的形式接收参数
    bus.on('countChange', (count) => {
      this.count = count
    })
  }
}
</script>

<style>
  .container {
    width: 400px;
    height: 300px;
    border: 1px solid #ccc;
    margin-left: 20px;
  }
</style>